﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sripirom.Pattern.UnitTest.Core.Domain;

namespace Sripirom.Pattern.UnitTest.Model.TestCases
{
    public class UnitTestFunction : BaseEntity<String>
    {
        private IList<UnitTestCase> _unitTestCases;
        public UnitTestFunction()
        {
            _unitTestCases = new List<UnitTestCase>();
        }

        public UnitTestFunction(IList<UnitTestCase> testCases)
        {
            _unitTestCases = testCases;
        }

        public IEnumerable<UnitTestCase> TestCases {  get { return _unitTestCases; } }

        public void AddTestCase(UnitTestCase testCase)
        {
            _unitTestCases.Add(testCase);
        }

        public void RemoveTestCase(UnitTestCase testCase) {
            UnitTestCase removeTestCase = _unitTestCases.FirstOrDefault(a => a == testCase);
            if (removeTestCase == null)
                throw new ArgumentOutOfRangeException("TestCase not found.");

            _unitTestCases.Remove(removeTestCase);
        }
        protected override void Validate()
        {
            throw new NotImplementedException();
        }
    }
}
